home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
001
/
pibt40s3.arc
/
PIBTDCL2.GLO
< prev
Wrap
Text File
|
1987-08-30
|
46KB
|
1,031 lines
{.C-}
(*----------------------------------------------------------------------*)
(* Definitions for Kermit protocol transfers *)
(*----------------------------------------------------------------------*)
CONST
MaxKermitWindowSize = 31;
MaxLongPacketLength = 1000;
TYPE
Kermit_Packet_Buffer = ARRAY[1..94] OF CHAR;
Kermit_Packet_Ptr = ^Kermit_Packet_Buffer;
Kermit_State_Vars = ( Send_Init, Send_File_Header, Send_File,
Send_EOF, Send_Break, Receive_Init,
Receive_Header, Receive_File, Send_Bye,
Get_File );
Kermit_File_Param = ( Kermit_Ascii, Kermit_Binary, Kermit_None );
Kermit_Packet_Param = ( Break_Pack, Data_Pack, Error_Pack,
Header_Pack, NAK_Pack, Send_Pack, Reserved_Pack,
ACK_Pack, End_Pack, Generic_Pack,
Text_Pack, Host_Pack, Attrib_Pack, Unknown );
Kermit_File_Modes = ( Read_Open, Write_Open );
Kermit_Window_Type_Record = RECORD
Data_Slot : INTEGER;
Data_Length : INTEGER;
ACK_Flag : BOOLEAN;
Retry_Count : INTEGER;
END;
(* Window packet queue *)
Kermit_Window_Queue_Type = ARRAY[0..63] OF Kermit_Window_Type_Record;
Kermit_Abort_Type = (No_Abort, One_File, All_Files, Entire_Protocol);
VAR
(* Type of file (Ascii, Binary) *)
Kermit_File_Type_Var : Kermit_File_Param;
(* Type of current Kermit packet *)
Kermit_Packet_Type : Kermit_Packet_Param;
(* Current state of Kermit transfer *)
Kermit_State : Kermit_State_Vars;
(* If remote kermit in server mode *)
Kermit_Remote_Server : BOOLEAN;
Kermit_Init_Packet_Size : INTEGER (* Initial max packet size *);
Kermit_Packet_Size : INTEGER (* Size of current packet *);
Kermit_Extended_Block: INTEGER (* Max size of long block *);
Kermit_Timeout : INTEGER (* Timeout value in seconds *);
His_TimeOut : INTEGER (* Timeout desired by remote *);
Kermit_Npad : INTEGER (* Number of padding characters *);
Kermit_EOL : CHAR (* End of line character *);
Kermit_Header_Char : CHAR (* Block header character *);
Kermit_Pad_Char : CHAR (* Padding character *);
Kermit_Quote_Char : CHAR (* Control-quote character *);
Kermit_Quote_8_Char : CHAR (* 8-bit quoting character *);
Kermit_Chk_Type : CHAR (* Block-check type *);
Kermit_Repeat_Char : CHAR (* Repeat character *);
Kermit_Handshake_Char: CHAR (* Handshake character *);
Packet_OK : BOOLEAN (* TRUE if packet OK *);
Ack_OK : BOOLEAN (* TRUE if packet ACK'd *);
Open_OK : BOOLEAN (* TRUE if file to transfer opened OK *);
File_Done : BOOLEAN (* TRUE if file being sent done *);
Kermit_Abort : BOOLEAN (* TRUE if keyboard entry aborts transfer *);
Kermit_Retry : BOOLEAN (* TRUE to retry current packet *);
Kermit_Really_Done : BOOLEAN (* TRUE if Kermit protocol done *);
(* Type of keyboard-originated abort *)
Kermit_Abort_Level : Kermit_Abort_Type;
Packet_Num : INTEGER (* Packet number being sent *);
Rec_Packet_Num : INTEGER (* Received packet number *);
Packets_Sent : REAL (* Number of packets sent *);
Packets_Received : REAL (* Number of packets received *);
Packets_Bad : REAL (* Number of errors in transfer *);
File_Open : BOOLEAN (* TRUE if file being transferred is open *);
Quoting : BOOLEAN (* TRUE if 8th-bit quoting in effect *);
Repeating : BOOLEAN (* TRUE if repeating/compression in effect *);
Sending_File : BOOLEAN (* TRUE if uploading, FALSE if downloading *);
Logging_Out_Server : BOOLEAN (* TRUE if logging out remote server *);
My_Pad_Char : CHAR (* Default pad character *);
His_Quote_Char : CHAR (* Remote kermit's quote character *);
His_Quote_8_Char : CHAR (* Remote kermit's 8th-bit quote character *);
His_Chk_Type : CHAR (* Remote kermit's block check type *);
His_Repeat_Char : CHAR (* Remote kermit's repeat quote char *);
My_Pad_Num : INTEGER (* Default number of padding characters *);
Send_EOL : INTEGER (* Send CR first time *);
File_Records : REAL (* Number of bytes in disk file *);
Buffer_Num : REAL (* How many characters read/written *);
Kermit_Delay_Time : INTEGER (* Time to wait before send in host mode *);
Receive_Done : BOOLEAN (* TRUE if file reception complete *);
Kermit_MaxTry : INTEGER (* Maximum number of retries allowed *);
Rec_Packet_Length : INTEGER (* Received packet data length *);
(* Points to received data *)
Rec_Packet_Ptr : Kermit_Packet_Ptr;
Send_Packet_Length : INTEGER (* Send packet data length *);
(* Points to data to send *)
Send_Packet_Ptr : Kermit_Packet_Ptr;
Kermit_Menu_Title : AnyStr (* Title for Kermit windows *);
Finish_Kermit_Server : BOOLEAN (* TRUE to stop remote server *);
Kermit_Debug : BOOLEAN (* TRUE if Kermit debug mode *);
Kermit_Transfer_Start: REAL (* Starting time of transfer *);
Kermit_Transfer_End : REAL (* Ending time of transfer *);
Kermit_Transfer_Rate : REAL (* Transfer rate in CPS *);
Kermit_Window_Size : INTEGER (* No. of packets in window *);
Kermit_Window_Top : BYTE (* Top packet in window *);
Kermit_Window_Bottom : BYTE (* Bottom packet in window *);
(* Window packet queue *)
Kermit_Queue : Kermit_Window_Queue_Type;
(*----------------------------------------------------------------------*)
(* Global script file variables *)
(*----------------------------------------------------------------------*)
CONST
Max_Script_File_Commands = 87 (* # of script commands *);
MaxScripts = 100 (* Maximum # of compiled scripts *);
MaxScriptCalls = 64 (* Maximum call depth within script *);
MaxScriptVariables = 100 (* Maximum variables each script *);
MaxNestedScripts = 10 (* Maximum nesting depth for scripts *);
MaxOperandTypes = 10 (* Maximum # of script data types *);
MaxWhenStrings = 10 (* Maximum # of WHEN strings *);
MaxWaitStrings = 20 (* Maximum # of WAIT strings *);
MaxScriptOpenFiles = 10 (* Maximum # of open script files *);
MaxNewCommands = 100 (* Maximum # of new commands *);
MaxScriptArgs = 20 (* Maximum # of script arguments *);
TYPE
OperandType = ( Bad_Operand_Type, Operator_Type, Integer_Variable_Type,
Real_Variable_Type, String_Variable_Type,
Integer_Constant_Type, Real_Constant_Type,
String_Constant_Type,
StackEnd_Type, Left_Paren_Type, Right_Paren_Type,
Comma_Type );
VAR
(* Script conversion table *)
PibTerm_Command_Table_2 : ARRAY[0..No_Of_PibTerm_Commands_Minus_One]
OF PibTerm_Command_Type;
TYPE
(* Generic buffer type to hold script *)
Script_Buffer_Type = ARRAY[1..1] OF BYTE;
(* For pointing to start of script *)
Script_Buffer_Ptr = ^Script_Buffer_Type;
(* Script variable definition *)
Script_Variable_Record = RECORD
Var_Name : String10;
Var_Type : OperandType;
Var_Passed : BOOLEAN;
Var_Temp : BOOLEAN;
Var_Value : StringPtr;
END;
Script_Variable_Record_Ptr = ^Script_Variable_Record;
(* Saves variables across CALLs *)
Script_Save_Variable_Record_Ptr = ^Script_Save_Variable_Record;
Script_Save_Variable_Record = RECORD
Save_Data : Script_Variable_Record_Ptr;
Prev_Var : Script_Save_Variable_Record_Ptr;
END;
(* Script variable list *)
Script_Variable_List = ARRAY[0..MaxScriptVariables] OF Script_Variable_Record;
Script_Variable_List_Ptr = ^Script_Variable_List;
(* Holds variable indices of parameters *)
Script_Parameter_Vector = ARRAY[1..MaxScriptArgs] OF INTEGER;
Script_Parameter_Ptr = ^Script_Parameter_Vector;
(* Defines a script record *)
Script_Record_Type = RECORD
Script_Name : STRING[8];
Script_Ptr : Script_Buffer_Ptr;
Script_Len : INTEGER;
Script_Vars_Count : INTEGER;
Script_Vars : Script_Variable_List_Ptr;
Script_Params_Count : INTEGER;
Script_Params : Script_Parameter_Ptr;
END;
(* Saves stack of EXECUTEd scripts *)
Script_Buffer_Save = RECORD
Script_Num : INTEGER;
Buffer_Pos : INTEGER;
Buffer_Ptr : Script_Buffer_Ptr;
Vars_Ptr : Script_Variable_List_Ptr;
Vars_Count : INTEGER;
Prev_Ptr : Script_Variable_List_Ptr;
Params_Ptr : Script_Parameter_Ptr;
Params_Count: INTEGER;
Params_Got : INTEGER;
END;
(* Saves stack of CALLed scripts *)
Script_Call_Stack_Type = RECORD
Proc_Param : Script_Parameter_Ptr;
Proc_Got : INTEGER;
Proc_Count : INTEGER;
Return_Addr : INTEGER;
Save_Vars : Script_Save_Variable_Record_Ptr;
END;
(* Search order for scripts *)
Script_Search_Order_Type = ( Dir_Then_Lib, Lib_Then_Dir, Dir_Only, Lib_Only );
(* Stack entry for script execution *)
Stack_Entry = RECORD
TypVal : OperandType;
IntVal : INTEGER;
StrVal : AnyStr;
END;
Stack_Entry_Ptr = ^Stack_Entry;
Script_When_Record = RECORD
When_Found: BOOLEAN;
When_Text : StringPtr;
Reply_Text: StringPtr;
END;
Script_Wait_Record = RECORD
Wait_Text : StringPtr;
Wait_Reply: StringPtr;
END;
Script_File_Record = RECORD
ReadOnly : BOOLEAN;
Opened : BOOLEAN;
EOF_Seen : BOOLEAN;
F : Text_File;
END;
Script_File_Record_Ptr = ^Script_File_Record;
VAR
(* Index of currently executing script *)
Current_Script_Num : INTEGER;
(* WHEN text to wait for *)
Script_When_Text : AnyStr;
(* Response text for WHEN *)
Script_When_Reply_Text : AnyStr;
(* Response text for WHENDROP *)
Script_When_Drop_Text : AnyStr;
(* Current input for WHEN checking *)
Script_When_Save : AnyStr;
(* Current input for WAITSTRING checking *)
Script_Wait_Save : AnyStr;
(* # of characters to wait for *)
Script_Wait_Char_Count : INTEGER;
(* # of 1/100 secs to wait quiet *)
Script_WaitQuiet_Time : REAL;
(* Time to wait for input string *)
Script_Wait_Time : INTEGER;
(* Default time to wait for input string *)
Script_Default_Wait_Time : INTEGER;
(* Starting time of day for wait *)
Script_Wait_Start : REAL;
(* Where to go to if wait string fails *)
Script_Wait_Failure : INTEGER;
(* Wait string appeared *)
Script_Wait_Found : BOOLEAN;
(* Size of script buffer *)
Script_Buffer_Size : INTEGER;
(* Pointer to compiled script text *)
Script_Buffer : Script_Buffer_Ptr;
(* Current position in script buffer *)
Script_Buffer_Pos : INTEGER;
(* Script integer values *)
Script_Integer_1 : INTEGER;
Script_Integer_2 : INTEGER;
Script_Integer_3 : INTEGER;
Script_Integer_4 : INTEGER;
(* Script text values *)
Script_String : AnyStr;
Script_String_2 : AnyStr;
Script_String_3 : AnyStr;
Script_String_4 : AnyStr;
(* Reply to Script INPUT prompt *)
Script_Reply : AnyStr;
(* Reply was OK *)
Script_Reply_Found : BOOLEAN;
(* Script suspend time period *)
Script_Suspend_Time : REAL;
(* Script suspend starting time *)
Script_Suspend_Start : REAL;
(* Reply to Script RINPUT prompt *)
Script_Remote_Reply : AnyStr;
(* Reply was OK *)
Script_Remote_Reply_OK : BOOLEAN;
(* Marker for parameter substitution *)
Script_Parameter_Marker: CHAR;
(* Scripts compiled and loaded *)
Scripts : ARRAY[1..MaxScripts] OF Script_Record_Type;
(* Number of compiled scripts *)
Script_Count : 0..MaxScripts;
(* Script variables *)
Script_Variables : Script_Variable_List_Ptr;
(* Number of script variables active *)
Script_Variable_Count : 0..MaxScriptVariables;
(* Script parameter variables *)
Script_Parameters : Script_Parameter_Ptr;
(* Number of script parameters active *)
Script_Parameter_Count : 0..MaxScriptVariables;
Script_Parameter_Got : 0..MaxScriptVariables;
(* Previous script's variables *)
Prev_Script_Variables : Script_Variable_List_Ptr;
(* Save positions in nested scripts *)
Script_Stack_Position : ARRAY[0..MaxNestedScripts] OF Script_Buffer_Save;
Script_Stack_Depth : 0..MaxNestedScripts;
(* Save positions in script procedures *)
Script_Call_Stack : ARRAY[0..MaxScriptCalls] OF Script_Call_Stack_Type;
Script_Call_Depth : 0..MaxScriptCalls;
(* Procedure parameter variables *)
Proc_Parameters : Script_Parameter_Ptr;
(* Number of script parameters active *)
Proc_Parameter_Count : 0..MaxScriptVariables;
Proc_Parameter_Got : 0..MaxScriptVariables;
(* Learn variables *)
Script_Learn_Buffer_Size : INTEGER (* Learning buffer size *);
Script_Learn_Lines : INTEGER (* Max. # of successive WaitStrings *);
Script_Learn_Line_Count : INTEGER (* Count of WaitStrings generated *);
Script_Wait_Generated : BOOLEAN (* TRUE if WaitString generated *);
(* Search order type *)
Script_Search_Order : Script_Search_Order_Type;
(* Vector of WHEN strings *)
Script_When_List : ARRAY[1..MaxWhenStrings] OF Script_When_Record;
Script_When_Count : 0..MaxWhenStrings;
(* Vector of WAIT strings *)
Script_Wait_List : ARRAY[1..MaxWaitStrings] OF Script_Wait_Record;
(* # of active waitstrings *)
Script_Wait_Count : 0..MaxWaitStrings;
(* Variable to receive wait index *)
Script_Wait_Result_Index : INTEGER;
(* # chars to save for wait check *)
Script_Wait_Check_Length : INTEGER;
(* Vector of files for use in scripts *)
Script_File_List : ARRAY[0..MaxScriptOpenFiles] OF Script_File_Record_Ptr;
(* If given file used in script *)
Script_File_Used : ARRAY[0..MaxScriptOpenFiles] OF BOOLEAN;
(* # of files opened in script *)
Script_File_Count : 0..MaxScriptOpenFiles;
Script_IO_Error : INTEGER (* I/O error in script *);
(* User-defined commands *)
Script_New_Commands : ARRAY[1..MaxNewCommands] OF STRING[8];
Script_New_Command_Count : INTEGER;
(* TRUE if executing command key script *)
Script_Command_Key_Mode : BOOLEAN;
(*----------------------------------------------------------------------*)
(* Command line mode variables *)
(*----------------------------------------------------------------------*)
VAR
Command_Key : INTEGER (* Function which invokes command *);
Command_Key_Name : STRING[20] (* Command key name *);
Command_Key_Text : AnyStr (* Text of command line *);
Use_Prev_Key_Text: BOOLEAN (* TRUE to use prev. text to start *);
(*----------------------------------------------------------------------*)
(* Global error return from DOS *)
(*----------------------------------------------------------------------*)
VAR
Ierr : INTEGER (* DOS return error *);
(*----------------------------------------------------------------------*)
(* Global screen positioning for autodownloads *)
(*----------------------------------------------------------------------*)
VAR
NewX : INTEGER;
OldX : INTEGER;
NewY : INTEGER;
OldY : INTEGER;
(*----------------------------------------------------------------------*)
(* Gossip mode definitions screen *)
(*----------------------------------------------------------------------*)
VAR
Gossip_Window_Size : INTEGER (* Number of lines in top window *);
Gossip_Line_Mode : BOOLEAN (* TRUE if line-edit GOSSIP mode *);
(*----------------------------------------------------------------------*)
(* Session timers *)
(*----------------------------------------------------------------------*)
VAR
Session_Start_Time: REAL (* Starting time of entire session *);
Dialing_Start_Time: REAL (* Starting time current dialing *);
(*----------------------------------------------------------------------*)
(* Global graphics positions *)
(*----------------------------------------------------------------------*)
VAR
Graphics_XPos: INTEGER;
Graphics_YPos: INTEGER;
CONST
INT24Err : BOOLEAN = FALSE;
INT24ErrCode : BYTE = 0;
OldINT24 : ARRAY[1..2] OF INTEGER = ( 0 , 0 );
VAR
RegisterSet : RegPack;
(*----------------------------------------------------------------------*)
(* *)
(* COMMUNICATIONS HARDWARE ADDRESSES *)
(* *)
(* These are specific to IBM PCs and close compatibles. *)
(* *)
(*----------------------------------------------------------------------*)
CONST
UART_THR = $00; (* offset from base of UART Registers for IBM PC *)
UART_RBR = $00;
UART_IER = $01;
UART_IIR = $02;
UART_LCR = $03;
UART_MCR = $04;
UART_LSR = $05;
UART_MSR = $06;
I8088_IMR = $21; (* port address of the Interrupt Mask Register *)
COM1_Base = $03F8; (* port addresses for the UART *)
COM2_Base = $02F8;
COM3_Base = $03E8;
COM4_Base = $02E8;
COM1_Irq = 4; (* Interrupt line for the UART *)
COM2_Irq = 3;
COM3_Irq = 4;
COM4_Irq = 3;
COM1_RS232 = $F8; (* RS 232 base pointers for UART *)
COM2_RS232 = $F8;
COM3_RS232 = $E8;
COM4_RS232 = $E8;
RS232_Base = $0400 (* Address of RS 232 com port pointer *);
MaxComPorts = 4 (* Four ports allowed by this code *);
CONST
Async_DSeg_Save : INTEGER = 0; (* Save DS reg in Code Segment for *)
(* interrupt routine *)
(*----------------------------------------------------------------------*)
(* *)
(* COMMUNICATIONS BUFFER VARIABLES *)
(* *)
(* The Communications Buffer is implemented as a circular (ring) *)
(* buffer, or double-ended queue. The asynchronous I/O routines *)
(* enter characters in the buffer as they are received. Higher- *)
(* level routines may extract characters from the buffer. *)
(* *)
(* Note that this buffer is used for input only; output is done *)
(* on a character-by-character basis. *)
(* *)
(*----------------------------------------------------------------------*)
CONST
TimeOut = 256 (* TimeOut value *);
Async_XON = ^Q (* XON character *);
Async_XOFF = ^S (* XOFF character *);
Async_Overrun_Error = 2 (* overrun *);
Async_Parity_Error = 4 (* parity error *);
Async_Framing_Error = 8 (* framing error *);
Async_Break_Found = 16 (* break interrupt *);
Async_CTS = $10 (* Clear to send *);
Async_DSR = $20 (* Data set ready *);
TYPE
Async_Buffer_Type = ARRAY[0..1] OF CHAR;
Async_Ptr = ^Async_Buffer_Type;
VAR (* Port addresses for serial ports *)
Com_Base : ARRAY[1..MaxComPorts] OF INTEGER;
(* IRQ line for each serial port *)
Com_Irq : ARRAY[1..MaxComPorts] OF INTEGER;
(* RS 232 addresses for each port *)
Com_RS232 : ARRAY[1..MaxComPorts] OF INTEGER;
(* Default addresses of each com port *)
Default_Com_Base : ARRAY[1..MaxComPorts] OF INTEGER;
(* Default IRQ line for each port *)
Default_Com_Irq : ARRAY[1..MaxComPorts] OF INTEGER;
(* Default RS232 base addresses of each port *)
Default_Com_RS232 : ARRAY[1..MaxComPorts] OF INTEGER;
VAR
Async_Buffer_Ptr : Async_Ptr (* Input buffer address *);
Async_OBuffer_Ptr : Async_Ptr (* Output buffer address *);
Async_Open_Flag : BOOLEAN (* true if port opened *);
Async_Port : INTEGER (* current open port number (1 -- 4) *);
Async_Base : INTEGER (* base for current open port *);
Async_Irq : INTEGER (* IRQ for current open port *);
Async_RS232 : INTEGER (* RS232 address for current port *);
Async_Buffer_Overflow : BOOLEAN (* True if buffer overflow has happened *);
Async_Buffer_Used : INTEGER (* Amount of input buffer used so far *);
Async_MaxBufferUsed : INTEGER (* Maximum amount of input buffer used *);
(* Async_Buffer empty if Head = Tail *)
Async_Buffer_Head : INTEGER (* Loc in Async_Buffer to put next char *);
Async_Buffer_Tail : INTEGER (* Loc in Async_Buffer to get next char *);
Async_OBuffer_Overflow : BOOLEAN (* True if buffer overflow has happened *);
Async_OBuffer_Used : INTEGER (* Amount of output buffer used *);
Async_MaxOBufferUsed : INTEGER (* Max amount of output buffer used *);
(* Async_Buffer empty if Head = Tail *)
Async_OBuffer_Head : INTEGER (* Loc in Async_Buffer to put next char *);
Async_OBuffer_Tail : INTEGER (* Loc in Async_Buffer to get next char *);
Async_Buffer_Low : INTEGER (* Low point in receive buffer for XON *);
Async_Buffer_High : INTEGER (* High point in receive buffer for XOFF*);
Async_Buffer_High_2 : INTEGER (* Emergency point for XOFF *);
Async_XOFF_Sent : BOOLEAN (* If XOFF sent *);
Async_XOFF_Received : BOOLEAN (* If XOFF received *);
Async_XOFF_Rec_Display : BOOLEAN (* If XOFF received *);
Async_XON_Rec_Display : BOOLEAN (* If XOFF received *);
Async_Baud_Rate : INTEGER (* Current baud rate *);
(* Save previous serial interrupt status *)
Async_Save_IAddr : ARRAY[1..2] OF INTEGER;
Async_Do_CTS : BOOLEAN (* TRUE to do clear-to-send checking *);
Async_Do_DSR : BOOLEAN (* TRUE to do data-set-ready checking *);
Async_Do_XonXoff : BOOLEAN (* TRUE to do XON/XOFF flow checking *);
Async_Hard_Wired_On : BOOLEAN (* TRUE if hard-wired connection *);
Async_Break_Length : INTEGER (* Length of break in 1/10 seconds *);
Async_Line_Status : BYTE (* Line Status Reg at interrupt *);
Async_Modem_Status : BYTE (* Modem Status Reg at interrupt *);
Async_Line_Error_Flags : BYTE (* Line status bits accumulated *);
Async_Buffer_Size : INTEGER (* Stores input buffer size *);
Async_OBuffer_Size : INTEGER (* Stores output buffer size *);
Async_Uart_IER : INTEGER (* Interrupt enable register address *);
Async_Uart_IIR : INTEGER (* Interrupt ID register address *);
Async_Uart_MSR : INTEGER (* Modem status register address *);
Async_Uart_LSR : INTEGER (* Line status register address *);
Async_Send_XOFF : BOOLEAN (* TRUE to send XOFF ASAP *);
Async_Send_Address : INTEGER (* Address of async send routine *);
Async_Output_Delay : INTEGER (* Delay in ms when output buffer full *);
Async_OneMSDelay : INTEGER (* Loop count value to effect 1 ms delay*);
VAR
Async_Buffer_Length : INTEGER (* Receive buffer length *);
Async_OBuffer_Length : INTEGER (* Send buffer length *);
(*----------------------------------------------------------------------*)
(* Definitions for screen memory reading/writing *)
(*----------------------------------------------------------------------*)
CONST
Color_Screen_Address = $B800 (* Address of color screen *);
Mono_Screen_Address = $B000 (* Address of mono screen *);
Screen_Length = 4000 (* 80 x 25 x 2 = screen area length *);
Graphics_Screen_Length = 16000 (* Length of graphics screen area *);
Max_Saved_Screen = 6 (* Maximum no. of saved screens *);
MedRes_GraphMode = 4 (* Medium resolution graphics *);
HiRes_GraphMode = 6 (* High resolution graphics mode *);
Mono_TextMode = 7 (* Monochrome adapter text mode *);
CRT_Index = $03D4 (* CRT index register *);
CRT_Data = $03D5 (* CRT data register *);
CRT_Mode = $03D8 (* CRT mode register *);
CRT_Color_Select = $03D9 (* CRT color select register *);
CRT_Status = $03DA (* CRT status port *);
CRT_Mode_Byte = $0465 (* CRT mode byte *);
Turbo_Screen_Width = $016A (* Where Turbo stores screen width *);
Turbo_Screen_Length = $016B (* Where Turbo stores screen length *);
TYPE
(* A screen image *)
Screen_Type = ARRAY[ 1 .. Graphics_Screen_Length ] OF BYTE;
Screen_Ptr = ^Screen_Image_Type;
Screen_Image_Type = RECORD
Screen_Image: Screen_Type;
END;
(* Screen stack entries *)
Saved_Screen_Ptr = ^Saved_Screen_Type;
Saved_Screen_Type = RECORD
Screen_Row : INTEGER;
Screen_Column : INTEGER;
Screen_X1 : INTEGER;
Screen_Y1 : INTEGER;
Screen_X2 : INTEGER;
Screen_Y2 : INTEGER;
Window_X1 : INTEGER;
Window_Y1 : INTEGER;
Window_X2 : INTEGER;
Window_Y2 : INTEGER;
Screen_Size : INTEGER;
Video_Mode : INTEGER;
If_BIOS : BOOLEAN;
Screen_Image : Screen_Type;
END;
CONST
Video_Interrupt = $10 (* Video interrupt number *);
CONST (* Save previous video interrupt status. *)
(* Note: THESE MUST BE IN CODE SEGMENT! *)
Video_Save_Iaddr2 : INTEGER = 0;
Video_Save_Iaddr1 : INTEGER = 0;
Video_Request : INTEGER = 0 (* Current video request *);
Video_Fill : INTEGER = 0 (* Fill attribute *);
Video_Page : BYTE = 0 (* Text memory page *);
Video_Mode : BYTE = 3 (* Current text mode *);
Video_Screen_Addr : INTEGER = $B800 (* Screen memory address *);
VAR
Max_Screen_Col : INTEGER (* PC's screen width *);
Wrap_Screen_Col : INTEGER (* Column at which to wrap *);
Max_Screen_Line : INTEGER (* PC's screen length *);
(* Memory-mapped screen area *)
Actual_Screen : Screen_Ptr;
(* Saves screen behind menus *)
Saved_Screen : Saved_Screen_Ptr;
(* Stack of saved screens *)
Saved_Screen_List : ARRAY[ 1 .. Max_Saved_Screen ] OF Saved_Screen_Ptr;
(* Depth of saved screen stack *)
Current_Saved_Screen : 0 .. Max_Saved_Screen;
(* Upper left corner of *)
(* current TURBO window *)
VAR
Upper_Left_Column : INTEGER;
Upper_Left_Row : INTEGER;
(* Lower right corner of *)
(* current TURBO window *)
VAR
Lower_Right_Column : INTEGER;
Lower_Right_Row : INTEGER;
VAR
Global_ForeGround_Color : INTEGER;
Global_BackGround_Color : INTEGER;
Global_Border_Color : INTEGER;
Global_Text_Attribute : INTEGER;
(*----------------------------------------------------------------------*)
(* Multitasker definitions *)
(*----------------------------------------------------------------------*)
TYPE
MultiTaskerType = ( MultiTasker_None, DoubleDos, DesqView, TopView,
MSWindows, APXCore, EZDosIt, Concurrent_DOS,
TaskView, MultiLink, Other );
VAR
TimeSharingActive : BOOLEAN (* TRUE if multitasker active *);
(* Which multitasker active *)
MultiTasker : MultiTaskerType;
DesqView_Screen : Screen_Ptr (* Alternate display buffer address *);
Graphics_Screen : Screen_Ptr (* Graphics display buffer address *);
(*----------------------------------------------------------------------*)
(* Menu constants, types, and variables *)
(*----------------------------------------------------------------------*)
CONST
Up_arrow = ^E; (* move up in menu code *)
Down_arrow = ^X; (* move down in menu code *)
Space_bar = #32; (* space bar *)
Ch_cr = #13; (* Carriage return *)
Ch_esc = #27; (* Escape *)
Ch_bell = #07; (* Bell *)
Max_Menu_Items = 21; (* Maximum number of menu choices *)
Dont_Erase_Menu = FALSE;
Erase_Menu = TRUE;
TYPE
String40 = STRING[40] (* Menu entry string type *);
String80 = STRING[80] (* Menu title string type *);
Menu_Entry = RECORD
Menu_Item_Text : String40; (* Text of entry *)
Menu_Item_Row : BYTE; (* Row position of menu item *)
Menu_Item_Column : BYTE; (* Column position of menu item *)
END;
Menu_Type = RECORD
Menu_Size : 1 .. Max_Menu_Items; (* No. of items in menu *)
Menu_Title : String80; (* Menu title *)
Menu_Row : BYTE; (* Row position of menu *)
Menu_Column : BYTE; (* Column position of menu *)
Menu_Width : BYTE; (* Width of menu *)
Menu_Height : BYTE; (* Height of menu *)
Menu_Default : 1 .. Max_Menu_Items; (* Default value position *)
Menu_TColor : BYTE; (* Foreground text color *)
Menu_BColor : BYTE; (* BackGround color *)
Menu_FColor : BYTE; (* Frame color *)
Menu_HColor : BYTE; (* Title color *)
(* Menu items themselves *)
Menu_Entries : ARRAY[ 1 .. Max_Menu_Items ] Of Menu_Entry;
END;
VAR
Menu_Explode_Mode : BOOLEAN (* TRUE to use exploding menus *);
Menu_Beep_Mode : BOOLEAN (* TRUE to beep on errors *);
Menu_Depth : INTEGER (* Depth of current menus *);
VAR
(* Box-drawing characters for menus *)
Menu_Box_Chars : RECORD
Top_Left_Corner : CHAR;
Top_Line : CHAR;
Top_Right_Corner : CHAR;
Right_Line : CHAR;
Bottom_Right_Corner : CHAR;
Bottom_Line : CHAR;
Bottom_Left_Corner : CHAR;
Left_Line : CHAR;
END;
(* For MENU command *)
Script_Menu_Holder : ^Menu_Type;
(*----------------------------------------------------------------------*)
(* Map of MsDos Directory Entry *)
(*----------------------------------------------------------------------*)
TYPE
Directory_Record = RECORD
Filler : ARRAY[1..21] Of BYTE;
File_Attr : BYTE;
File_Time : INTEGER;
File_Date : INTEGER;
File_Size : ARRAY[1..2] Of INTEGER;
File_Name : ARRAY[1..80] Of CHAR;
END;
CONST
Dir_Attr_Read_Only = 1;
Dir_Attr_Hidden = 2;
Dir_Attr_System = 4;
Dir_Attr_Volume_Label = 8;
Dir_Attr_Subdirectory = 16;
Dir_Attr_Archive = 32;
Access_Read_Mode = 0;
Access_Write_Mode = 1;
Access_Read_And_Write_Mode = 2;
Attribute_None = 0;
Attribute_Read_Only = 1;
Attribute_Hidden = 2;
Attribute_System = 4;
Attribute_Volume_Label = 8;
Attribute_Subdirectory = 16;
Attribute_Archive = 32;
VAR (* Easier addressing in INLINE *)
Global_Crc : INTEGER;
VAR (* DOS error flag *)
Err: INTEGER;
VAR
(* Saves screen in batch transfers *)
Batch_Screen_Ptr : Saved_Screen_Ptr;
Kermit_Local_Save : Saved_Screen_Ptr (* Saves screen for Kermit *);
(*----------------------------------------------------------------------*)
(* Initialization/Parameter resetting variables *)
(*----------------------------------------------------------------------*)
VAR (* Hold new colors/video mode *)
New_Text_Mode : INTEGER;
New_ForeGround_Color : INTEGER;
New_BackGround_Color : INTEGER;
New_Menu_Text_Color : INTEGER;
New_Menu_Title_Color : INTEGER;
New_Menu_Frame_Color : INTEGER;
New_Border_Color : INTEGER;
New_Menu_Text_Color_2 : INTEGER;
Review_Buffer_Length : INTEGER;
Last_Line_To_Set : INTEGER;
Kbd_Interrupt_Change : BOOLEAN;
Video_Interrupt_Change : BOOLEAN;
(*----------------------------------------------------------------------*)
(* DOS jump interface variables *)
(*----------------------------------------------------------------------*)
CONST (* DO NOT REDUCE *)
NewStackSize = 1700 (* Stack size to keep while in DOS shell (>700) *);
MinDOSspace = 20000 (* Min bytes for DOS shell to run *);
StackBufferSize = MaxSectorLength (* Bytes in DOS stack buffer *);
VAR
TopOfStack : INTEGER;
StackBuffer : ARRAY[1..StackBufferSize] OF BYTE ABSOLUTE Sector_Data;
StackSeg : INTEGER;
StackPtr : INTEGER;
NewStackSeg : INTEGER;
NewStackPtr : INTEGER;
ParasToKeep : INTEGER;
ParasWeHave : INTEGER;
ParasForDos : INTEGER;
ExecStatus : INTEGER;
CommandStr : AnyStr;
Error_Found : BOOLEAN;
(*----------------------------------------------------------------------*)
(* Module Interface Vectors *)
(*----------------------------------------------------------------------*)
CONST
MainModule = 0;
PT4TERM = 1;
PT4KERM = 2;
PT4XMOD = 3;
PT4EDIT = 4;
PT4HOST = 5;
PT4USER = 6;
PT4DIAL = 7;
PT4SCRI = 8;
PT4SETP = 9;
PT4INIT = 10;
PT4UTIL = 11;
PT4T4010 = 12;
PT4GOSSI = 13;
MaxNumModules = 20;
MaxStackSize = 255;
VAR (* Overlay section if a module is *)
(* already loaded *)
ModuleLoaded: ARRAY[1..MaxNumModules] OF INTEGER;
(*----------------------------------------------------------------------*)
(* Overlay section definitions (NOT standard Extender) *)
(*----------------------------------------------------------------------*)
CONST
MaxNumOverlays = 3 (* Number of overlays *);
TYPE
(* Holds info describing module *)
(* overlay areas *)
PointerType = ^INTEGER;
OverlayAreaRecord = RECORD
Pointer : PointerType;
Size : INTEGER;
OverlaySeg : INTEGER;
CurrentModule : INTEGER;
END;
VAR
(* Holds descriptive information *)
(* regarding reserved overlay areas *)
OverlayArea : ARRAY[0..MaxNumOverlays] OF OverlayAreaRecord;
LoadingOverlay : BOOLEAN (* TRUE if loading overlay *);
GlobalOverlayNum : INTEGER (* Overlay section being loaded into *);
(*----------------------------------------------------------------------*)
(* Forward declarations *)
(*----------------------------------------------------------------------*)
PROCEDURE WriteSXY( S: AnyStr; X: INTEGER; Y: INTEGER; Color: INTEGER );
FORWARD;
FUNCTION DateString : AnyStr;
FORWARD;
{.C+}